spb/satelliteindex
Public
TypeScript 66.5%
Python 30.9%
JavaScript 1.4%
CSS 0.7%
1import { NextResponse } from 'next/server';2import { adminApi, AdminApiError } from '@/lib/admin-api';3import { isAdmin } from '@/lib/admin-auth';45export const dynamic = 'force-dynamic';67/** Queue a manual connector run (proxied to FastAPI with the server-side token). Requires the admin session cookie. */8export async function POST(_req: Request, ctx: { params: Promise<{ name: string }> }): Promise<Response> {9 if (!(await isAdmin())) return NextResponse.json({ error: { title: 'Unauthorized', status: 401 } }, { status: 401 });10 const { name } = await ctx.params;11 try {12 const out = await adminApi.triggerRun(name);13 return NextResponse.json(out.data);14 } catch (e) {15 const status = e instanceof AdminApiError && e.status > 0 ? e.status : 502;16 return NextResponse.json({ error: { title: 'Run request failed', detail: (e as Error).message, status } }, { status });17 }18}19